﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Addres.ascx.cs" Inherits="Shop.Web.Controls.Addres" %>
<asp:PlaceHolder runat="server" id="phFirstStep">
<script type="text/javascript">
</script>
<table id="registration">
        <tr>
            <td>Индекс</td>
            <td><asp:TextBox runat="server" id="tbPostcode" MaxLength="6" SkinID="Required" Text="426000"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>Город</td>
            <td><asp:TextBox runat="server" id="tbCity" MaxLength="150" SkinID="Required" Text="Ижевск"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>Адрес</td>
            <td><asp:TextBox runat="server" id="tbLocation" MaxLength="150" SkinID="Required"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>Контактный телефон</td>
            <td><asp:TextBox runat="server" id="tbPhone" MaxLength="20" SkinID="popup"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>Использовать по умолчанию</td>
            <td><input type="checkbox" Checked="Checked" id="chbDfault"/></td>
            <td></td>
        </tr>
        </table>
        <script type="text/javascript">
        function SaveAddr() {
            if (Valid($('#<%=tbPostcode.ClientID %>')) &&
                Valid($('#<%=tbCity.ClientID %>')) &&
                Valid($('#<%=tbLocation.ClientID %>')) &&
                Valid($('#<%=tbPhone.ClientID %>')))
          {
          HideError();
          $.post("AjaxHtmlContent.aspx?Content=AddresAdd",
                   {    postcode: $('#<%=tbPostcode.ClientID %>').val(),
                        city    : $('#<%=tbCity.ClientID %>').val(),
                        location: $('#<%=tbLocation.ClientID %>').val(),
                        phone   : $('#<%=tbPhone.ClientID %>').val(),
                        dfault  : $('#chbDfault')[0].checked
                    }, 
                   function(data){
                    $('#<%=tbPostcode.ClientID %>').val("426000");
                    $('#<%=tbCity.ClientID %>').val("Ижевск");
                    $('#<%=tbLocation.ClientID %>').val("");
                    $('#<%=tbPhone.ClientID %>').val("");
                    $(".dialog").dialog('close');
                    $(".required").each(function() { SetValid($(this)) });
                    $(".addres_list").html(data);
                   } 
                   );}
                   else
                   {
                    Error("Заполните все поля корректно");
                   }
        }
       
        </script>
</asp:PlaceHolder>
